<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        // 通过循环按行顺序为一个5×5的二维数组a赋1到25的自然数，然后输出该数组。试编程。 // 结果 [ [1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20], [21, 22, 23, 24, 25] ]
        // var arr = [];
    //  arr[0][1] = 1
    console.time()
        var s = 0;
        var arr = [];
        for (var i = 0; i < 5; i++) {
            arr[i] = [];
            for (var j = 0; j < 5; j++) {
                     arr[i][j] = ++s
                    // arr[i][j].push=++s;
                   
            }
        }

        console.log(arr)
console.timeEnd();
console.time()
        var arr = [];
        var smallArr = []
        for (var i = 1; i <= 25; i++) {
            smallArr.push(i)
            if (i % 5 == 0) {
                arr.push(smallArr)
                smallArr = []
            }
        }

        console.log(arr);
        console.timeEnd();
    </script>
</head>

<body>

</body>

</html>